<!DOCTYPE html>
<html>
<head>
<base href="${basePath}">
<meta charset="UTF-8">
<title>班级课程信息</title>
$!{include("import_js_css.html")}
</head>
<body>
	$!{include("header.html")}
	<div class="container" style="width: 1200px;margin-top:70px;">
		<div class="panel panel-info">
			<div id="div_result_member" style="padding: 15px;">
				<div class="panel panel-info">
					<ul class="nav nav-tabs nav-justified"
						style="background-color: #D0D0D0;">
						<li><a href="yueyogaAdmin/findAllClass.jhtml?classId=${classId}">基本信息</a></li>
						<li class="active"><a>班级课程</a></li>
					</ul>
					<div id="div_result_member" style="padding: 15px; height:400px">
						<!--#var(Chedule chedule, PaginatedList<Chedule> chedules)-->
						<!--
								#set(
								pager = chedules.pager,
								totalResults = pager.getCountOfTotalResults(),
								totalPages = pager.getCountOfTotalPages() * 1,
								pageSize = pager.pageSize,
								pageNo = pager.pageNo,
								prePageNo = (pageNo==1?1:pageNo -1),
								nextPageNo = (totalPages==pageNo?totalPages:(pageNo + 1))
								)
						-->
						
						<form name="cheduleForm" action="yueyogaAdmin/seachMember_Chedule.jhtml" method="post">
							<input name="classId" type="hidden" value="${classId}">
							<input name="pageNo" type="hidden" value="1">
						</form>
						
						
						<table class="table table-bordered table-hover table-condensed">
							<tbody>
								<tr class="active">
									<th style="text-align: center; background-color: #B3D9D9;"
										width="5%"><input type="checkbox" onclick="selectAll()"
										name="cheduleAll" id="cheduleAll"></th>
									<th style="text-align: center; background-color: #B3D9D9;"
										width="15%">周数</th>
									<th style="text-align: center; background-color: #B3D9D9;"
										width="15%">开始时间</th>
									<th style="text-align: center; background-color: #B3D9D9;"
										width="15%">结束时间</th>
									<th style="text-align: center; background-color: #B3D9D9;">教练</th>
									<th style="text-align: center; background-color: #B3D9D9;">助教</th>
									<th style="text-align: center; background-color: #B3D9D9;">场地</th>
									<!-- <th style="text-align: center; background-color: #B3D9D9;"
										width="10%">操作</th> -->
								</tr>
							</tbody>
							<tbody>
								<!--#foreach(chedule in chedules)-->
								<tr>
									<td align="center"><input type="checkbox"
										value="${chedule.id}" name="selectid" id="selectid" /></td>
									<td align="center">${chedule.week}</td>
									<td align="center">${chedule.starttime}</td>
									<td align="center">${chedule.endtime}</td>
									<td align="center">${chedule.teacher.name}</td>
									<td align="center">${chedule.assistant.name}</td>
									<td align="center">${chedule.place.name}</td>
									<!-- <td align="center"><a href="toUpdateClassChedule.jthml?cheduleId=${chedule.id}"><input class="btn btn-default ub_btn"
											type="button" value="修改"></a></td> -->
									<!--#end-->
							</tbody>
						</table>
						<input type="button" value="添加" class="btn btn-default" onclick="" />&nbsp;&nbsp;&nbsp;
						<input type="button" value="删除" class="btn btn-default"
							onclick="deleteChdeule()" />
						<div class="div_page main_div_page">
							<ul class="pagination">
								<li><a href="javascript:void(0);" onclick="changePage(1)">首页</a></li>
								<!-- #if(pageNo<=1) -->
								<li class="disabled"><a href="javascript:void(0);" onclick="changePage(1)">上一页</a></li>
								<!-- #else -->
								<li><a href="javascript:void(0);" onclick="changePage(${prePageNo})">上一页</a></li>
								<!-- #end -->
								<!-- #if(pageNo>=totalPages) -->
								<li class="disabled"><a href="javascript:void(0);" onclick="changePage(${totalPages})">下一页</a></li>
								<!-- #else -->
								<li><a href="javascript:void(0);" onclick="changePage(${nextPageNo})">下一页</a></li>
								<!-- #end -->
								<li><a href="javascript:void(0);" onclick="changePage(${totalPages})">尾页</a></li>
								<li><a>第<input id="txtPageNumber" value="${pageNo}"
										onkeydown="this.value=this.value.replace(/\D/g,'')"
										onkeyup="changePage(this.value)"
										onafterpaste="this.value=this.value.replace(/\D/g,'')" type="text" />-${totalPages}页/${totalResults}条
								</a></li>
							</ul>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<script type="text/javascript">
		function selectAll() {
			var checklist = document.getElementsByName("selectid");
			if (document.getElementById("cheduleAll").checked) {
				for ( var i = 0; i < checklist.length; i++) {
					checklist[i].checked = 1;
				}
			} else {
				for ( var j = 0; j < checklist.length; j++) {
					checklist[j].checked = 0;
				}
			}
		}
		function deleteChdeule() {
			var cheduleIds = document.getElementsByName("selectid");
			var ids = "";
			for ( var i = 0; i < cheduleIds.length; i++) {
				if (cheduleIds[i].checked) {
					ids = ids + cheduleIds[i].value + ",";
				}
			}
			if (ids == "") {
				alert("请选择删除的课程");
			} else {
				if (confirm('确定要删除吗？')) {
					ids = ids.substring(0, ids.length - 1);
					var url = "/yueyoga_all2014/yueyogaAdmin/deleteClassChedule.jhtml?ids="+ids;
					$.post(url,function (response){
						if(response){
							alert("删除成功!");
						}else{
							alert("删除失败!");
						}
					},"json");
				}
			}
		}
		
		function changePage(value) {
			value = value * 1;
			var totalPages = '${totalPages}';
			if (value > totalPages) {
				value = totalPages;
			} else if (value < 1) {
				value = 1;
			}
			$("#txtPageNumber").val(value);
			$("input[name='pageNo']").val(value);
			document.cheduleForm.submit();
		}
	</script>
</body>
</html>
